(function () {
  let singer = document.querySelector('#singer')
  // let eil = Array.from(ei)
  const queryData = function queryData() {
    return new Promise(resolve => {
      let xhr = new XMLHttpRequest;
      xhr.open('GET', './Alljson/入驻歌手/data.json');
      xhr.onreadystatechange = () => {
        if (xhr.readyState === 4 && xhr.status === 200) {
          let data = JSON.parse(xhr.responseText);
          resolve(data);
        }
      };
      xhr.send();
    });
  };

  const binding = function binding(data) {
    let str = ``
    data.forEach(item => {
      let { pic, p1, p2 } = item
      str += `<li>
      <img src="${pic}" alt="">
      <div>
        <h4>${p1}</h4>
        <p>${p2}</p>
      </div>
    </li>`
    })
    return str
  }

  queryData().then(value => {
    let html = binding(value)
    singer.innerHTML = html
  })

})()